<!--
  ~ Copyright [2021-2021] [ahoo wang <ahoowang@qq.com> (https://github.com/Ahoo-Wang)].
  ~ Licensed under the Apache License, Version 2.0 (the "License");
  ~ you may not use this file except in compliance with the License.
  ~ You may obtain a copy of the License at
  ~      http://www.apache.org/licenses/LICENSE-2.0
  ~ Unless required by applicable law or agreed to in writing, software
  ~ distributed under the License is distributed on an "AS IS" BASIS,
  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  ~ See the License for the specific language governing permissions and
  ~ limitations under the License.
  -->

<form nzLayout="horizontal" nz-form>
  <nz-form-item>
    <nz-form-label [nzSpan]="3">ConfigId</nz-form-label>
    <nz-form-control [nzSpan]="21">
      <input nz-input type="text"
             [ngModel]="configHistory.configId" disabled
             [ngModelOptions]="{standalone: true}"
      />
    </nz-form-control>
  </nz-form-item>
  <nz-form-item>
    <nz-form-label [nzSpan]="3">Hash</nz-form-label>
    <nz-form-control [nzSpan]="21">
      <input nz-input type="text"
             [ngModel]="configHistory.hash" disabled
             [ngModelOptions]="{standalone: true}"
      />
    </nz-form-control>
  </nz-form-item>
  <nz-form-item>
    <nz-form-label [nzSpan]="3">Version</nz-form-label>
    <nz-form-control [nzSpan]="21">
      <input nz-input type="text"
             [ngModel]="configHistory.version" disabled
             [ngModelOptions]="{standalone: true}"
      />
    </nz-form-control>
  </nz-form-item>
  <nz-form-item>
    <nz-form-label [nzSpan]="3">CreateTime</nz-form-label>
    <nz-form-control [nzSpan]="21">
      <input nz-input type="text"
             [ngModel]="configHistory.createTime * 1000 | date:'yyyy-MM-dd HH:mm:ss'" disabled
             [ngModelOptions]="{standalone: true}"
      />
    </nz-form-control>
  </nz-form-item>
  <nz-form-item>
    <nz-form-label [nzSpan]="3">Op</nz-form-label>
    <nz-form-control [nzSpan]="21">
      <input nz-input type="text"
             [ngModel]="configHistory.op" disabled
             [ngModelOptions]="{standalone: true}"
      />
    </nz-form-control>
  </nz-form-item>
  <nz-form-item>
    <nz-form-label [nzSpan]="3">OpTime</nz-form-label>
    <nz-form-control [nzSpan]="21">
      <input nz-input type="text"
             [ngModel]="configHistory.opTime * 1000 | date:'yyyy-MM-dd HH:mm:ss'" disabled
             [ngModelOptions]="{standalone: true}"
      />
    </nz-form-control>
  </nz-form-item>
  <nz-divider [nzText]="'Current Data - VS - History Version:'+configHistory.version"></nz-divider>
  <ngx-monaco-diff-editor
    style="min-height: 660px;"
    [options]=" {theme:'vs-dark',readOnly:true}" [originalModel]="configCurrentCode"
    [modifiedModel]="configHistoryCode"
    (onInit)="onInitDiffEditor($event)"></ngx-monaco-diff-editor>
  <nz-divider></nz-divider>
  <nz-form-item>
    <button nz-button nzType="primary" nzSize="large" nzDanger nzBlock (click)="rollback()">Rollback To
      Version:[{{configHistory.version}}]
    </button>
  </nz-form-item>
</form>



